package methodTest

import "fmt"

type Monkey struct {
	name string
}

func (this *Monkey) flying() {
	panic("implement me")
}

func (this *Monkey) swimming() {
	panic("implement me")
}

type Bird interface {
	flying()
	swimming()
}
type a interface {
}
type LittleMonkey struct {
	Monkey
}
type BigMonkey struct {
	Monkey
}

func (this *BigMonkey) flying() {
	fmt.Println(this.name, "生来会飞")
}
func (this *LittleMonkey) flying() {
	fmt.Println(this.name, "生来会飞")
}
func (this *BigMonkey) swimming() {
	fmt.Println(this.name, "我会游泳")

}
func (this *LittleMonkey) swimming() {
	fmt.Println(this.name, "我会游泳")

}
func (this *LittleMonkey) SetName(name string) {
	this.name = name

}
func (this *LittleMonkey) GetName() string {
	return this.name
}
func (this *BigMonkey) SetName(name string) {
	this.name = name

}
func (this *BigMonkey) GetName() string {
	return this.name
}
func (this *Monkey) climbing() {
	fmt.Println(this.name, "生来会爬树")

}
func (this *LittleMonkey) String() string {
	return fmt.Sprintf("name=%v\n", this.name)
}
func NewLittleMonkey() *LittleMonkey {
	return &LittleMonkey{}
}
func NewBigMonkey() *BigMonkey {
	return &BigMonkey{}
}
func MonkeyTest() {
	var a interface{}
	var bird [3]Bird
	bird[0] = NewLittleMonkey()
	bird[1] = NewBigMonkey()
	bird[2] = &Monkey{}
	var m Monkey = Monkey{"张三"}
	var c Monkey
	a = m
	c = a.(Monkey)
	fmt.Println(c)
	fmt.Printf("a=%T\n", a)
	fmt.Printf("%T", bird)
	fmt.Printf("%T", bird)
}
